'''
Created on Apr 10, 2011

@author: u074363
'''


import httplib2
from urllib.parse import urlencode


class client(object):

    def __init__(self, host='localhost', port=80, basePath="durastore",
                 cache=None):
        """Init with the host and port values, defaults are given
        """
        self.host = host
        self.basePath = basePath
        self.port = port
        if cache:
            #TODO: Check for valid path, raise exception
            self.cache = cache
        else:
            self.cache = cache

    def initializeStores(self):
        if self.cache:
            h = httplib2.Http(cache=self.cache)
        else:
            h = httplib2.Http()
        RESTRequest = "http://%s:%d/%s/stores" % (self.host, self.port,
                                                  self.basePath)
        response, content = h.request(RESTRequest)
        return response, content
